home *** CD-ROM | disk | FTP | other *** search
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %% 09.12.1991: Andreas Scherer %%
- %% Einige der Uebungen aus dem Metafontbook von D.E.K. %%
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- font_identifier "KNUTH";
-
- font_size 10pt#;
-
- mode_setup;
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %% Metafontbook Seite 18. %%
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- beginchar("a",3cm#,3cm#,0pt#);
- pickup pencircle scaled .1pt;
-
- for d = 0 step 10 until 120:
- draw (0,0){dir 60}..{dir -d}(w,0); endfor;
- endchar;
-
- beginchar("b",3cm#,3cm#,0pt#);
- pickup pencircle scaled .1pt;
-
- for d = 0 step -10 until -90:
- draw (0,0){dir 60}..{dir -d}(w,0); endfor;
- endchar;
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %% Metafontbook Seite 134. %%
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- beginchar("c",2cm#,2cm#,0pt#);
- path heart,p;
-
- pickup pencircle scaled .1pt;
-
- heart = (100,162)..(140,178){right}..(195,125){down}..(100,0){curl0}
- ..{up}(5,125)..{right}(60,178)..(100,162);
-
- p = (100,0)--(300,0)--(200,0)--(100,0)--(0,0)--(-100,0)--(100,0);
-
- for n = 0 upto 10: draw interpath(n/10,p,heart) scaled (w/200); endfor;
- endchar;
-
- beginchar("d",2cm#,2cm#,0pt#);
- path heart,p;
-
- pickup pencircle scaled .1pt;
-
- heart = (100,162)..(140,178){right}..(195,125){down}..(100,0){curl0}
- ..{curl0}(100,0)..{up}(5,125)..{right}(60,178)..(100,162);
-
- p = (100,200)--(200,200)--(200,100)--(200,0)--(0,0)--(0,100)
- --(0,200)--(100,200);
-
- for n = 0 upto 10: draw interpath(n/10,p,heart) scaled (w/200); endfor;
- endchar;
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %% Metafontbook Seite 138. %%
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- beginchar("A",29mm#,25mm#,0);
- thick# := 2mm#; thin# := 5/4mm#;
- define_whole_blacker_pixels(thick,thin);
-
- forsuffixes $ = a,b,c:
- transform $;
- forsuffixes e = l,r:
- path $e, $'e;
- numeric t$[]e; endfor; endfor;
-
- penpos1(thick,0); penpos2(thick,90); penpos3(thick,180);
- penpos4(thick,270); penpos5(thick,0); penpos6(thick,90);
- penpos7(thick,180); penpos8(thick,270);
-
- x2 = x4 = x6 = x8 = .5[x5,x7] = .5w; x1r = w; x3r = 0; x5-x7 = y6-y8;
- y1 = y3 = y5 = y7 = .5[y6,y8] = .5h; y2r = h; y4r = 0; y6r = .75h;
-
- forsuffixes e = l,r:
- a.e = b'e = c'e = superellipse(z1e,z2e,z3e,z4e,.75);
- a'e = b.e = c.e = superellipse(z5e,z6e,z7e,z8e,.72); endfor;
-
- penpos a1(thin,0); penpos a5(whatever,-90); penpos a9(thin,180);
-
- x.a1l-x.a9l = 1/3(x5l-x7l); x.a5 = .5w; y.a1 = y.a9; y.a5r = 4/7h;
- x.a3l = x.a1l; x.a3r = x.a1r; x.a4r = 1/6[x.a3r,x1l]; x0 = .5w; y0 = .52h;
- x.a6l+x.a4l = x.a6r+x a4r = x.a7l+x.a3l = x.a7r+x.a3r = x.a9+x.a1 = w;
- y.a3r = y.a4r = y.a6r = y.a7r = .2[y2l,y0]; y.a3l = y.a4l = y.a6l = y.a7l =
- y.a3r-thin;
- z.a4l = z.a4r+(thin,0) rotated (angle(z.a4r-z.a5r) + 90)
- + whatever*(z.a4r-z.a5r);
- z.a4l-z.a5l = whatever*(z.a4r-z.a5r);
- z = a.r intersectionpoint (z0--(w,0)); y.a1-y.a5 = length(z-z0);
- b = identity shifted (0,y0-y.a1) rotatedaround (z0,90-angle(z0-(w,0)));
- c = b reflectedabout (z2,z4);
-
- for n = 1,3,4,5,6,7,9:
- forsuffixes e = l,r:
- forsuffixes $ = b,c:
- z.$[n]e = z.a[n]e transformed $; endfor; endfor; endfor;
-
- forsuffixes e = l,r:
- forsuffixes $ = a,b,c:
- z.$2e = $r intersectionpoint (z.$1e--z.$3e);
- z.$8e = $r intersectionpoint (z.$9e--z.$7e);
- t.$1e = xpart($e intersectiontimes (z.$1l--z.$3l));
- t.$9e = xpart($e intersectiontimes (z.$9l--z.$7l));
- t.$4e = xpart($'e intersectiontimes (z.$5r--z.$4l));
- t.$6e = xpart($'e intersectiontimes (z.$5r--z.$6l)); endfor; endfor;
-
- penstroke subpath(t.a9e,t.b6e) of a.e;
- penstroke subpath(t.b4e,t.c4e) of b'e;
- penstroke subpath(t.c6e,t.a1e+8) of c'e;
- penstroke subpath(t.a6e,t.b9e) of a'e;
- penstroke subpath(t.b1e,t.c1e) of b.e;
- penstroke subpath(t.c9e,t.a4e+8) of c.e;
-
- forsuffixes $ = a,b,c:
- penlabels($1,$2,$3,$4,$5,$6,$7,$8,$9);
- penstroke z.$2e--z.$3e--z.$4e--z.$5e--z.$6e--z.$7e--z.$8e; endfor;
-
- penlabels(range 0 thru 8);
- endchar;
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %% Metafontbook Seite 126. %%
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- beginchar("T",.5in#,1.25in#,0);
- path branch[],trunk;
-
- branch1 = flex((0,660),(-9,633),(-22,610))
- & flex((-22,610),(-3,622),(17,617))
- & flex((17,617),(7,637),(0,660)) & cycle;
-
- branch2 = flex((30,570),(10,590),(-1,616))
- & flex((-1,616),(-11,592),(-29,576),(-32,562))
- & flex((-32,562),(-10,577),(30,570)) & cycle;
-
- branch3 = flex((-1,570),(-17,550),(-40,535))
- & flex((-40,535),(-45,510),(-60,477))
- & flex((-60,477),(-20,510),(40,512))
- & flex((40,512),(31,532),(8,550),(-1,570)) & cycle;
-
- branch4 = flex((0,509),(-14,492),(-32,481))
- & flex((-32,481),(-42,455),(-62,430))
- & flex((-62,430),(-20,450),(42,448))
- & flex((42,448),(38,465),(4,493),(0,509)) & cycle;
-
- branch5 = flex((-22,470),(-23,435),(-44,410))
- & flex((-44,410),(-10,421),(35,420))
- & flex((35,420),(15,455),(-22,470)) & cycle;
-
- branch6 = flex((18,375),(9,396),(5,420))
- & flex((5,420),(-5,410),(-50,375),(-50,350))
- & flex((-50,350),(-25,375),(18,375)) & cycle;
-
- branch7 = flex((0,400),(-13,373),(-30,350))
- & flex((-30,350),(0,358),(30,350))
- & flex((30,350),(13,373),(0,400)) & cycle;
-
- branch8 = flex((50,275),(45,310),(3,360))
- & flex((3,360),(-20,330),(-70,300),(-100,266))
- & flex((-100,266),(-75,278),(-60,266))
- & flex((-60,266),(0,310),(50,275)) & cycle;
-
- branch9 = flex((10,333),(-15,290),(-43,256))
- & flex((-43,256),(8,262),(58,245))
- & flex((58,245),(34,276),(10,333)) & cycle;
-
- branch10 = flex((8,262),(-21,249),(-55,240))
- & flex((-55,240),(-51,232),(-53,220))
- & flex((-53,220),(-28,229),(27,235))
- & flex((27,235),(16,246),(8,262)) & cycle;
-
- branch11 = flex((0,250),(-25,220),(-70,195))
- & flex((-70,195),(-78,180),(-90,170))
- & flex((-90,170),(-5,188),(74,183))
- & flex((74,183),(34,214),(0,250)) & cycle;
-
- branch12 = flex((8,215),(-35,175),(-72,155))
- & flex((-72,155),(-75,130),(-92,110),(-95,88))
- & flex((-95,88),(-65,117),(-54,104))
- & flex((-54,104),(10,151),(35,142)) .. flex((42,130),(60,123),(76,124))
- & flex((76,124),(62,146),(26,180),(8,215)) & cycle;
-
- trunk = (0,660)---(-12,70)..{curl5}(-28,-8)
- & flex((-28,-8),(-16,-4),(-10,-11))
- & flex((-10,-11),(0,-5),(14,-10))
- & flex((14,-10),(20,-6),(29,-11))
- & (29,-11){curl4}..(10,100)---cycle;
-
- fill superellipse((w,.5h),(.5w,h),(0,.5h),(.5w,0),.8);
-
- branch0 = trunk;
-
- for n = 0 upto 12:
- unfill branch[n] shifted (150,50) scaled (w/300); endfor;
- endchar;
-
- end.
-